/* created at 2008-07-03:01:21:35 */
package pl.kwiecienm.jcomet.output;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

import pl.kwiecienm.jcomet.calculations.Sum;
import pl.kwiecienm.jcomet.model.AnalysisResult;

/**
 * @author kwiecienm
 */
public class PlotOutputWritter extends AbstractWritter implements
        SingleResultWritter {

    /** */
    private String _outputPath;

    /**
     * @param inOutputPath
     */
    public PlotOutputWritter(String inOutputPath) {
        this._outputPath = inOutputPath;
    }

    /**
     * @param analysisResult
     */
    public void write(AnalysisResult inAnalysisResult) {
        BufferedWriter out = null;
        try {
            out = new BufferedWriter(new FileWriter(this._outputPath));
            out.write("YVALUE=" + inAnalysisResult.get(Sum.CALCULATION_SUM));
            out.close();
        } catch (IOException e) {
            // ignore
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    // ignore
                }
            }
        }
    }
}
